<template>
<form>
  <slot></slot>
  <slot name="formfooter">
    <el-button>提交</el-button>
  </slot>
</form>
</template>

<script>
export default {
  name: "mkForm",
  data(){
    return{
      vaildateArr:[]
    }
  },
  methods:{
    validate(){
      return new Promise(resolve => {
        let res = this.vaildateArr.map(func => func()).every(r=>r)
        resolve(res)
      })
    }
  },
  created() {
    this.$on('inputchange',(res)=>{
      console.log('父亲监听到了',res)
      this.vaildateArr.push(res)
    })
  }
}
</script>

<style scoped>

</style>